package com.photopicker.main.activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.photopicker.R;
import com.photopicker.base.BaseActivity;

public class MainActivity extends BaseActivity implements View.OnClickListener{

    private Button btn_photo_picker;
    private Button btn_save_image;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initViews() {
        btn_photo_picker = (Button) findViewById(R.id.btn_photo_picker);
        btn_save_image = (Button) findViewById(R.id.btn_save_image);
    }

    @Override
    protected void initEvents() {
        btn_photo_picker.setOnClickListener(this);
        btn_save_image.setOnClickListener(this);
    }

    @Override
    protected int getContentViewLayoutId() {
        return R.layout.activity_main;
    }


    @Override
    public void onClick(View view) {
        switch (view.getId()){
            //多图选择
            case R.id.btn_photo_picker:
                startActivity(PhotoPickerActivity.class,null);
                break;
            //保存图片
            case R.id.btn_save_image:
                startActivity(SaveImageActivity.class,null);
                break;
        }
    }
    protected void startActivity(Class<?> cls, Bundle bundle) {
        Intent intent = new Intent();
        intent.setClass(this, cls);
        if (bundle != null) {
            intent.putExtras(bundle);
        }
        startActivity(intent);
    }
}
